#include"common.hpp"
#include"log.hpp"
using namespace std;

int main()
{
    Log log;
    
  
  //logmessage(Normal,"你好");
    //首先打开管道文件，并设置可写
    int fd=open(FIPE_PATH,O_WRONLY);
    if(fd<0)
    {
         log(Fatal," error string:%s,exit code:%d",strerror(errno),errno);
        exit(OPEN_FILE_ERROR);
    }

    string line;
    //写入文件中
    while(true)
    {
        cout<<"client sent@:";
        getline(cin,line);


        write(fd,line.c_str(),line.size());
        if(line=="quit" || line=="quit;")
        {
            break;
        }
    }
    close(fd);

    return 0;
}